<template>
  <div>
    <avue-form v-model="searchForm" :option="searchFormOption">
      <template slot="bomCode">
        <div>{{ swStConductorSettle.bomCode }}</div>
      </template>
      <template slot="deviceOperateNum">
        <div>{{ swStConductorSettle.deviceOperateNum }}</div>
      </template>
      <template slot="realAmount">
        <div>{{ swStConductorSettle.realAmount }}</div>
      </template>
      <template slot="adanceAmount">
        <div>{{ swStConductorSettle.adanceAmount }}</div>
      </template>
      <template slot="passengerAttendantName">
        <div>{{ swStConductorSettle.passengerAttendantName }}</div>
      </template>
      <template slot="passengerAttendantJobNo">
        <div>{{ swStConductorSettle.passengerAttendantJobNo }}</div>
      </template>
      <template slot="settleTime">
        <div>{{ swStConductorSettle.settleTime }}</div>
      </template>
       <template slot="workingStartTime">
        <div>{{ swStConductorSettle.workingStartTime }}</div>
      </template>
      <template slot="workingEndTime">
        <div>{{ swStConductorSettle.workingEndTime }}</div>
      </template>
      <template slot="guardTime">
        <div>{{ swStConductorSettle.guardTime }}</div>
      </template>
      <template slot="remark">
        <div>{{ swStConductorSettle.remark }}</div>
      </template>
    </avue-form>
    <!-- <avue-group label="售票员日结算数据明细"> </avue-group>
    <el-form label-width="40px">
      <el-tabs v-model="activeName">
        <el-tab-pane label="线下正常售卖(售票员)" name="first">
          <avue-crud
            :data="tableDataOffine"
            :option="tableOptionOffine"
          ></avue-crud>
        </el-tab-pane>
        <el-tab-pane label="线下取票明细" name="second">
          <avue-crud
            :data="tableDataOffineTicket"
            :option="tableOptionOffineTicketView"
          >
            <template slot="receiptFilePath" slot-scope="{ row }">
              <el-link
                type="primary"
                :href="row.receiptFilePath"
                v-if="row.receiptFilePath != null"
                >下载</el-link
              >
            </template>
          </avue-crud>
        </el-tab-pane>
        <el-tab-pane label="团购售卖" name="third">
          <avue-crud :data="tableDataGroup" :option="tableOptionGroupView">
            <template slot="receiptFilePath" slot-scope="{ row }">
              <el-link
                type="primary"
                :href="row.receiptFilePath"
                v-if="row.receiptFilePath != null"
                >下载</el-link
              >
            </template>
          </avue-crud>
        </el-tab-pane>
      </el-tabs>
    </el-form> -->
    <!-- <avue-group label="售票员日结算数据明细">
      <avue-crud :data="list" :option="tableOption"></avue-crud>
    </avue-group> -->
    <!-- <div class="bottom-menu">
      <el-button type="primary" @click="submit" :loading="isSubmit"
        >一键确认</el-button
      >
    </div> -->
  </div>
</template>

<script>
import { tableOptionOffine } from "@/const/crud/subwaystm/swstmarketingticket/swstmarketingticketoffinesell";
import {
  fenExYuangettoFixed,
  getSysDictItemListToDict
} from "@/api/subwaystm/swstmarketingticket/swstmarketingticketoffinesell";
import {
  tableOption,
  tableOptionView,
  tableOptionEdit
} from "@/const/crud/subwaystm/swstconductorsettle";
import {
  tableOptionGroup,
  tableOptionGroupView
} from "@/const/crud/subwaystm/swstmarketingticket/swstmarketingticketgroupsell";
import {
  tableOptionOffineTicket,
  tableOptionOffineTicketView
} from "@/const/crud/subwaystm/swstmarketingticket/swstmarketingticketoffinetaketicket";
import {
  getNeedConfirmData,
  confirm
} from "@/api/subwaystm/swstconductorsettle";
import { checkPwd } from "@/api/admin/user";
import { dateFormat } from "@/util/date";
export default {
  name: "conductor-settle",
  data() {
    return {
      tableOptionOffine: tableOptionOffine,
      tableOptionOffineTicketView: tableOptionOffineTicketView,
      tableOptionGroupView: tableOptionGroupView,
      activeName: "second",
      searchForm: {
        date: dateFormat(new Date()).substr(0, 10)
      },
      btn: false,
      swStConductorSettle: [],
      searchFormOption: {
        menuBtn: false,
        labelWidth: 115,
        group: [
          {
            label: "基本信息",
            column: [
              {
                label: "BOM编号",
                prop: "bomCode",
                type: "input",
                span: 6,
                detail: true,
                formslot: true
              },
	       {
                label: "设备操作号",
                prop: "deviceOperateNum",
                type: "input",
                span: 6,
                detail: true,
                formslot: true
              },
	       {
                label: "开始时间",
                prop: "workingStartTime",
                type: "date",
                span: 6,
                format: "yyyy-MM-dd HH:mm:ss",
                valueFormat: "yyyy-MM-dd HH:mm:ss",
                detail: true,
                formslot: true
              },
              {
                label: "结束时间",
                prop: "workingEndTime",
                type: "date",
                span: 6,
                format: "yyyy-MM-dd HH:mm:ss",
                valueFormat: "yyyy-MM-dd HH:mm:ss",
                detail: true,
                formslot: true
              },
	      {
                label: "收入日期",
                prop: "settleTime",
                type: "date",
                format: "yyyy-MM-dd HH:mm:ss",
                valueFormat: "yyyy-MM-dd HH:mm:ss",
                span: 6,
                detail: true,
                formslot: true
              },             
              {
                label: "实收总金额",
                prop: "realAmount",
                detail: true,
                formslot: true,
		span: 6,
                formatter: function(row, value, label, column) {
                  return fenExYuangettoFixed(row, "realAmount");
                }	
              },
              {
                label: "客运值班员",
                prop: "passengerAttendantName",
                span: 6,
                detail: true,
                formslot: true
              },
              {
                label: "客运值班员工号",
                prop: "passengerAttendantJobNo",
                span: 6,
                detail: true,
                formslot: true
              },
              /*{
                label: "预收款",
                prop: "adanceAmount",
                span: 6,
                detail: true,		
                formslot: true
              },*/
              {
                label: "上岗时间",
                prop: "guardTime", 
                type: "date",
                format: "yyyy-MM-dd HH:mm:ss",
                valueFormat: "yyyy-MM-dd HH:mm:ss",
                span: 6,
                detail: true,
                formslot: true
              },  
              {
                label: "备注",
                prop: "remark",
                type: "textarea",
                span: 24,
                formslot: true
              }
            ]
          }
        ]
      },
      list: [],
      tableOption: {
        border: true,
        header: false,
        align: "center",
        headerAlign: "center",
        menu: false,
        index: true,
        indexLabel: "序号",
        column: [
          {
            label: "票种",
            type: "select",
            props: {
              label: "票种",
              prop: "ticketType",
              label: "mainName",
              value: "mainEnName"
            },
            dicUrl: "/support/swpmticketcardtype/dict"
          },
          {
            label: "票价",
            prop: "ticketPrice"
          },
          {
            label: "废票张数（张）",
            prop: "scrapTicketNum"
          },
          {
            label: "售出张数（张）",
            prop: "sellOutNum"
          },
          {
            label: "现金售出张数（张）",
            prop: "cashSellNum"
          },
          {
            label: "现金售出金额",
            prop: "cashSellAmount"
          },
          {
            label: "支付宝售出张数（张）",
            prop: "alipaySellNum"
          },
          {
            label: "支付宝售出金额",
            prop: "alipaySellAmount"
          },
          {
            label: "微信售出张数（张）",
            prop: "wechatSellNum"
          },
          {
            label: "微信售出金额",
            prop: "wechatSellAmount"
          },
          {
            label: "折扣",
            prop: "discount"
          },
          {
            label: "实收总金额",
            prop: "sellOutAmount"
          }
        ]
      },
      isSubmit: false,
      //tableDataOffine: [],
      tableDataOffineTicket: [],
      tableDataGroup: []
    };
  },
  computed: {},
  methods: {
    getData(searchForm) {
      getNeedConfirmData(searchForm).then(response => {
        var result = response.data.data || {};
        //this.tableDataOffine = result.ticketOffineSells || [];
        this.tableDataOffineTicket = result.ticketOffineTakeTickets || [];
        this.tableDataGroup = result.ticketGroupSells || [];
        this.swStConductorSettle = result.swStConductorSettle || [];	
      });
      if (this.list.length == 0) {
        this.btn = true;
      }
    }
    // submit() {
    //   if (!this.searchForm.nsJobNo) {
    //     this.$message.info("请选择售票员");
    //     return;
    //   }
    //   this.isSubmit = true;
    //   this.$prompt("请输入售票员密码", "确认", {
    //     confirmButtonText: "确定",
    //     cancelButtonText: "取消",
    //     inputType: "password",
    //     inputValidator: val => {
    //       if (!val) return "请输入密码";
    //     }
    //   })
    //     .then(({ value }) => {
    //       return checkPwd(this.searchForm.nsJobNo, value);
    //     })
    //     .then(response => {
    //       var result = response.data.data;
    //       if (result) {
    //         return;
    //       } else {
    //         this.$message.error("密码错误");
    //         return Promise.reject("密码错误");
    //       }
    //     })
    //     .then(() => {
    //       return confirm(this.swStConductorSettle.id);
    //     })
    //     .then(() => {
    //       this.getData();
    //       this.$message.success("确认成功");
    //       this.isSubmit = false;
    //     })
    //     .catch(error => {
    //       console.log(error);
    //       this.isSubmit = false;
    //     });
    // }
  }
};
</script>

<style lang="scss" scoped>
.bottom-menu {
  text-align: center;
}
</style>
